package com.zh.note.demo.collection;

import java.util.Deque;
import java.util.LinkedList;

/**
 * @Author: zhanghuan
 * @date: 2023/7/2 14:13
 * @description: create it
 */
public class DequeDemo {

    public static void main(String[] args) {
        Deque<Integer> deque = new LinkedList<>();

        /**
         * 添加
         * 添加到头 addFirst push
         * 添加到尾部 add addLast offer
         */
        deque.offer(1);
        deque.offer(2);
        deque.add(3);
        deque.add(4);
        deque.push(5);
        deque.push(6);

        /**
         * 移除头部 poll pop remove peek
         * 移除尾部 removeLast
         */
        deque.poll();
        deque.pop();
        Integer peek = deque.peek();
        deque.remove();
        deque.removeLast();
    }
}
